from abc import ABCMeta,abstractmethod

#产品
class Player:
    def __init__(self,face=None,body=None,arm=None,leg=None):
        self.face = face
        self.body = body
        self.arm = arm
        self.leg = leg

    def __str__(self):
        return "%s,%s,%s,%s" % (self.body,self.face,self.arm,self.leg)

#抽象建造者
class PlayerBuilder(metaclass=ABCMeta):
    @abstractmethod
    def build_face(self):
        pass

    @abstractmethod
    def build_body(self):
        pass

    @abstractmethod
    def build_arm(self):
        pass

    @abstractmethod
    def build_leg(self):
        pass

#具体建造者
class SexGirlBuilder(PlayerBuilder):
    def __init__(self):
        self.player = Player()


    def build_face(self):
        self.player.face = '漂亮脸蛋'

    def build_body(self):
        self.player.body = '苗条'

    def build_arm(self):
        self.player.arm = '漂亮脸蛋'

    def build_leg(self):
        self.player.leg = '大长腿'

class MonsterBuilder(PlayerBuilder):
    def __init__(self):
        self.player = Player()

    #表示代码
    def build_face(self):
        self.player.face = '怪兽脸'

    def build_body(self):
        self.player.body = '怪兽身材'

    def build_arm(self):
        self.player.arm = '长毛的胳膊'

    def build_leg(self):
        self.player.leg = '长毛的腿'

#指挥者
class PlayertDirector:  #控制组装顺序
    def build_player(self,builder):
        #构造代码
        builder.build_body()
        builder.build_face()
        builder.build_arm()
        builder.build_leg()
        return builder.player

#client
#test =PlayerBuilder()
builder   = SexGirlBuilder()
director  = PlayertDirector()
p = director.build_player(builder)
print(p)
